from django.urls import path, include

from django.views import static
from django.conf import settings
from django.conf.urls import url
from django.views.generic.base import TemplateView
from . import view

urlpatterns = [
    path('article', TemplateView.as_view(template_name='articles.html')),
    url(r'edit$', TemplateView.as_view(template_name='editArticle.html')),
    path('create', TemplateView.as_view(template_name='createArticle.html')),
    path('', TemplateView.as_view(template_name='FrontPage.html')),
    path('person', TemplateView.as_view(template_name='personalFrontPage.html')),
    path('home', TemplateView.as_view(template_name='home.html')),
    path('info', TemplateView.as_view(template_name='personalInformation.html')),

    path('login', TemplateView.as_view(template_name='background/login.html')),
    path('back/index', view.index),
    path('back/personalInformation', TemplateView.as_view(template_name='background/personal_information.html')),

    # user
    path('back/user/list', TemplateView.as_view(template_name='background/pages/user/list.html')),
    path('back/user/edit', TemplateView.as_view(template_name='background/pages/user/edit.html')),
    path('back/user/add', TemplateView.as_view(template_name='background/pages/user/add.html')),
    path('back/user/password', TemplateView.as_view(template_name='background/pages/user/password.html')),

    # article
    path('back/article/list', TemplateView.as_view(template_name='background/pages/article/list.html')),
    path('back/article/show', TemplateView.as_view(template_name='background/pages/article/show.html')),
    path('back/article/category', TemplateView.as_view(template_name='background/pages/article/category.html')),

    # charts
    path('charts/chart', TemplateView.as_view(template_name='background/pages/charts/chart.html')),

    # api
    path('api/user/', include('blog.User.urls')),
    path('api/admin/', include('blog.Administrator.urls')),
    path('api/article/', include('blog.Article.urls')),
    path('api/charts/', include('blog.Chart.urls')),
    path('api/comment/', include('blog.Comment.urls')),

    # static url
    url(r'^static/(?P<path>.*)$', static.serve,
        {'document_root': settings.STATIC_ROOT}, name='static'),

    # url(r'docs/', include_docs_urls(title='接口文档')),
]
